use crate::config::httpie_config::KvPair;
use reqwest::Url;

pub fn parse_url(s: &str) -> Result<String, String> {
    Url::parse(s)
        .map_err(|_e| format!("无效的URL: {}", s))
        .map(|url| url.to_string())
}

pub fn parse_kv_pair(s: &str) -> Result<KvPair, String> {
    Ok(s.parse()?)
}
